package cn.iocoder.yudao.module.infra.vector;

import cn.iocoder.yudao.module.resource.api.model.messagecollection.VectorDoc;

import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface IVectorService {

    default List<VectorDoc> queryDoc(String partition,
                                               String vectorKey, List<? extends Number> vectorValue,
                                               String filter, Integer topk, Float minSimilarity,
                                               Collection<String> outputFields) {
        return queryDoc(partition,
                Map.of(vectorKey, vectorValue),
                Map.of(vectorKey, 1.0f),
                filter,
                topk,
                minSimilarity,
                outputFields);
    }

    List<VectorDoc> queryDoc(String partition,
                             Map<String, List<? extends Number>> vectors,
                             Map<String, Float> weights,
                             String filter, Integer topk, Float minSimilarity,
                             Collection<String> outputFields);


    void insertDoc(String docId,
                   Map<String, Object> fields,
                   Map<String, List<? extends Number>> vectorValues);

    void updateDoc(String docId,
                   Map<String, Object> fields,
                   Map<String, List<? extends Number>> vectorValues);

    void deleteDoc(String docId);
}
